{% import '@SyliusAdmin/Common/Macro/money.html.twig' as money %}

{% if refund_payments|length > 0 %}
    <div class="ui segment" id="refund-payments">
        <h3 class="ui dividing header">{{ 'sylius_refund.ui.refund_payments'|trans }}</h3>
        <table class="ui celled compact small table fixed">
            <thead>
            <tr>
                <th>{{ 'sylius.ui.total'|trans }}</th>
                <th>{{ 'sylius.ui.state'|trans }}</th>
                <th>{{ 'sylius.ui.actions'|trans }}</th>
            </tr>
            </thead>
            <tbody>
            {% for refund_payment in refund_payments %}
                <tr>
                    <td>{{ money.format(refund_payment.amount, refund_payment.currencyCode) }}</td>
                    <td>
                        {% include '@SyliusRefundPlugin/Common/Label/refundPaymentState.html.twig' with {'data': refund_payment.state} %}
                    </td>
                    <td class="aligned collapsing">
                        {% if sm_can(refund_payment, 'complete', 'sylius_refund_refund_payment') %}
                            <form action="{{ path('sylius_refund_complete_refund_payment', {'orderNumber': refund_payment.orderNumber, 'id': refund_payment.id}) }}" method="POST">
                                <button class="ui icon labeled yellow loadable button"><i class="check icon"></i> {{ 'sylius.ui.complete'|trans }}</button>
                            </form>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endif %}
